<template>
  <div class="app" >
<MyList :records="records" @changeMask="showMask" @showList="showList" @search="search"></MyList>
<MyMask :records="records" :isShow="isShow" @close="closeMsak" :maskList="maskList"></MyMask>
  </div>
</template>

<script>
import MyList from './components/MyList.vue';
import MyMask from './components/MyMask.vue';
export default {
  components: { MyList, MyMask },
  data(){
    // 渲染数据 父传子 App.vue的数据传给 MyList.vue 
    return{
      maskList:{},
      records: [
            {
              date: '2022-01-01',
              doctor: '张三',
              diagnosis: '感冒',
              prescription: '感冒药',
            },
            {
              date: '2022-02-01',
              doctor: '李四',
              diagnosis: '头疼',
              prescription: '止疼药',
            },
            {
              date: '2022-03-01',
              doctor: '王五',
              diagnosis: '腰痛',
              prescription: '止痛贴',
            }
],
        isShow:false
    }
  },
  methods:{
    showMask(newVal){
      this.isShow=newVal
    },
    showList(newList){
      // console.log(newList);
      // this.records=newList
      this.maskList=newList
      console.log(this.maskList);
    },
    closeMsak(newVal){
      console.log(newVal);
      this.isShow=newVal
    },
    search(newVal){
      this.records=newVal
    }
  }
}
</script>

<style>
</style>